<template>
  <van-cell-group class="mine_info mt20" inset>
    <van-field
      v-for="item in infoList"
      :key="item.label"
      :label="item.label"
      :left-icon="item.icon"
      :model-value="item.val"
      input-align="right"
      readonly
    />
  </van-cell-group>
</template>
<script setup>
import { getUserProfile } from "@/server/center/user.js";
import { useUsersStore } from "@/stores/user.js";
import { reactive } from "vue";

const { userInfo } = useUsersStore();
const infoList = reactive([
  { label: "昵称", icon: "manager", val: userInfo.nickName },
  { label: "手机号码", icon: "phone", val: userInfo.phonenumber },
  { label: "邮箱", icon: "envelop-o", val: userInfo.email },
  { label: "部门", icon: "friends", val: userInfo.dept.deptName },
  { label: "岗位", icon: "shop", val: "" },
  { label: "角色", icon: "cluster", val: userInfo.remark },
  { label: "创建日期", icon: "font", val: userInfo.createTime },
]);

getUserProfile().then((res) => {
  infoList[4].val = res.postGroup;
});
</script>
